import org.apache.spark.{SparkConf, SparkContext}

/**
  * @author dinghao 
  * @create 2021-08-19 10:09 
  * @message OK
  */
object HDFSSource {
  def main(args: Array[String]): Unit = {
    sparkReadHDFS()
  }

  def sparkReadHDFS(): Unit = {
    val sc = new SparkContext(new SparkConf().setAppName("HDFSSource").setMaster("local[*]"))
    sc.textFile(ConnectMessage.get("HDFSFile"))
      .flatMap(_.split(" "))
      .map((_,1))
      .reduceByKey(_+_)
      .collect
      .foreach(println)
  }
}
